let arr1 = [4, 3, 8, 2, 1, 5, 9, 6];

//简易版
function quickSort(arr) {
  if (arr.length == 0) return [];
  let middle = arr[0];
  let left = [];
  let right = [];
  for (let i = 1; i < arr.length; i++) {
    if (middle < arr[i]) {
      right.push(arr[i])
    } else {
      left.push(arr[i])
    }
  }
  left = quickSort(left);
  right = quickSort(right);
  left.push(middle);
  let sortArr = left.concat(right);
  return sortArr
}

console.log(quickSort(arr1));
